package top.naccl.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import top.naccl.entity.Comment;
import top.naccl.model.vo.PageComment;

import java.util.List;

/**
 * @Description: 博客评论持久层接口
 * @Author: Naccl
 * @Date: 2020-08-03
 */
@Mapper
@Repository
public interface CommentMapper {
	List<Comment> getListByPageAndParentCommentId(@Param("page") Integer page,@Param("blogId") Long blogId, @Param("parentCommentId") Long parentCommentId);

	List<Comment> getListByParentCommentId(@Param("parentCommentId") Long parentCommentId);

	List<PageComment> getPageCommentListByPageAndParentCommentId(@Param("page") Integer page, @Param("blogId") Long blogId, @Param("parentCommentId") Long parentCommentId);

	Comment getCommentById(@Param("id") Long id);

	int updateCommentPublishedById(@Param("commentId") Long commentId, @Param("published") Boolean published);

	int updateCommentNoticeById(@Param("commentId") Long commentId, @Param("notice") Boolean notice);

	int deleteCommentById(@Param("commentId") Long commentId);

	int deleteCommentsByBlogId(@Param("blogId") Long blogId);

	int updateComment(Comment comment);

	int countByPageAndIsPublished(@Param("page") Integer page, @Param("blogId") Long blogId, @Param("isPublished") Boolean isPublished);

	int countComment();

	int saveComment(top.naccl.model.dto.Comment comment);
}
